package com.jl.jlapp.mvp.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import butterknife.BindView;
import butterknife.ButterKnife;

import com.jl.jlapp.R;
import com.jl.jlapp.eneity.AdvertisementByIdModel;
import com.jl.jlapp.eneity.EffectAdvertisementByTypeModel;
import com.jl.jlapp.eneity.EffectAdvertisementByTypeModel.ResultDataBean;
import com.jl.jlapp.nets.Api;
import com.jl.jlapp.nets.CommonObserver;
import com.jl.jlapp.nets.Net;
import com.jl.jlapp.nets.Transformer;

import io.reactivex.Flowable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

import java.util.List;

public class ScreenActivity extends AppCompatActivity implements OnClickListener {
    List<EffectAdvertisementByTypeModel.ResultDataBean> advertisementListByType0;
    Handler handler = new Handler();
    @BindView(R.id.page_img)
    ImageView img;
    Runnable runnable;
    int screenAdId = 0;

    private void init() {
        Net.get().getEffectAdvertisementByType(0)
        .compose(Transformer.<EffectAdvertisementByTypeModel>switchSchedulers())
        .subscribe(new CommonObserver<EffectAdvertisementByTypeModel>() {
            @Override
            protected void onError(String errorMsg) {

            }

            @Override
            protected void onSuccess(EffectAdvertisementByTypeModel effectAdvertisementByTypeModel) {

            }
        });
    }

    private void setClickEvent() {
        this.img.setOnClickListener(this);
    }

    public void onClick(View paramView) {
        this.handler.removeCallbacks(this.runnable);
        Net.get().getAdvertisementById(this.screenAdId)
        .compose(Transformer.<AdvertisementByIdModel>switchSchedulers())
        .subscribe(new CommonObserver<AdvertisementByIdModel>() {
            @Override
            protected void onError(String errorMsg) {

            }

            @Override
            protected void onSuccess(AdvertisementByIdModel advertisementByIdModel) {

            }
        });
    }

    protected void onCreate(Bundle paramBundle) {
        super.onCreate(paramBundle);
        setContentView(R.layout.activity_screen);
        ButterKnife.bind(this);
        init();
        this.runnable = new Runnable() {
            public void run() {
                Intent localIntent = new Intent();
                localIntent.setClass(ScreenActivity.this, BaseActivity.class);
                ScreenActivity.this.startActivity(localIntent);
                ScreenActivity.this.finish();
            }
        };

        handler.postDelayed(runnable,3000);
    }
}


/* Location:              /Users/davidzhang/Documents/decompileApk/jlfood-dex2jar.jar!/com/jl/jlapp/mvp/activity/ScreenActivity.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */